﻿using MyX.Core;
using MyX.Message;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyX.Work
{
    public class XReplayManage
    {
        public static void Register(XIWorkRun run)
        {
            _works.Add(run);
        }

        public static void Replay(XEvent e)
        {
            _works.ForEach(x =>
                {
                    if (x.Filter(e))
                        x.Do(e);
                });
        }

        private static List<XIWorkRun> _works = new List<XIWorkRun>();
    }
}
